package com.wsx.java.boddy.agent.okhttp;

import com.wsx.java.boddy.agent.AbstractTransform;
import net.bytebuddy.dynamic.ClassFileLocator;
import net.bytebuddy.dynamic.DynamicType;
import net.bytebuddy.matcher.ElementMatchers;

/**
 * @author wangshuaixin
 * @Title: com.wsx.java.boddy.agent.okhttp.OkHttpTransform
 * @Description: TODO
 * @date 2019/02/19
 */
public class OkHttpTransform extends AbstractTransform {

    public OkHttpTransform(String inteceptor) {
        super(inteceptor);
    }

    @Override
    protected DynamicType.Builder.MethodDefinition.ImplementationDefinition builderTransform(DynamicType.Builder<?> builder, ClassFileLocator.Compound compound) {
        return builder.method(ElementMatchers.named("proceed")
                .and(ElementMatchers.returns(ElementMatchers.named("okhttp3.Response"))));
    }
}
